package com.zy.sso.server.entites;

import java.time.LocalDateTime;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zy.sso.client.dto.BaseUser;

/**
 * 用户实体
 * ***/
@Document(collection="zj_user")
public class User extends BaseUser {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	private String id;
	
	private String encrypeClass;
	
	private String reportSys;//上报系统
	
	@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
	private LocalDateTime updateTime;
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getEncrypeClass() {
		return encrypeClass;
	}

	public void setEncrypeClass(String encrypeClass) {
		this.encrypeClass = encrypeClass;
	}

	public String getReportSys() {
		return reportSys;
	}

	public void setReportSys(String reportSys) {
		this.reportSys = reportSys;
	}

	public LocalDateTime getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(LocalDateTime updateTime) {
		this.updateTime = updateTime;
	}
	
	public static class UserBuilder{
		
		private User user;
		
		public UserBuilder(String account, String password) {
			user = new User();
			user.setAccount(account);
			user.setPassword(password);
        }
		
		public UserBuilder buildGid(String gid){
			user.setGid(gid);
			return this;
		}
		
		public UserBuilder buildEncrypeClass(String encrypeClass){
			user.setEncrypeClass(encrypeClass);
			return this;
		}
		
		public UserBuilder buildFromSystem(String fromSystem){
			user.setFromSystem(fromSystem);
			return this;
		}
		
		public UserBuilder buildStatus(UserStatus status){
			user.setStatus(status);
			return this;
		}
		
		public UserBuilder buildCreateTime(LocalDateTime createTime){
			user.setCreateTime(createTime);
			return this;
		}
	    
		public User build() {
            return user;
        }
		
		
	}

	

}
